home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qtabbar.h.z / qtabbar.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  2.2 KB  |  102 lines

  1. /****************************************************************************
  2. ** $Id: qtabbar.h,v 2.12 1998/07/03 00:09:53 hanord Exp $
  3. **
  4. ** Definition of QTabBar class
  5. **
  6. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  7. **
  8. ** This file is part of Qt Free Edition, version 1.40.
  9. **
  10. ** See the file LICENSE included in the distribution for the usage
  11. ** and distribution terms, or http://www.troll.no/free-license.html.
  12. **
  13. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  14. ** your own programs or libraries.
  15. **
  16. ** Please see http://www.troll.no/pricing.html for information about 
  17. ** Qt Professional Edition, which is this same library but with a
  18. ** license which allows creation of commercial/proprietary software.
  19. **
  20. *****************************************************************************/
  21.  
  22. #ifndef QTABBAR_H
  23. #define QTABBAR_H
  24.  
  25. #ifndef QT_H
  26. #include "qwidget.h"
  27. #include "qpainter.h"
  28. #include "qlist.h"
  29. #endif // QT_H
  30.  
  31. struct QTabPrivate;
  32.  
  33.  
  34. struct QTab
  35. {
  36.     QTab(): enabled( TRUE ), id( 0 ) {}
  37.     virtual ~QTab();
  38.  
  39.     QString label;
  40.     // the bounding rectangle of this - may overlap with others
  41.     QRect r;
  42.     bool enabled;
  43.     int id;
  44. };
  45.  
  46.  
  47. class QTabBar: public QWidget
  48. {
  49.     Q_OBJECT
  50.  
  51. public:
  52.     QTabBar( QWidget * parent = 0, const char * name = 0 );
  53.    ~QTabBar();
  54.  
  55.     enum Shape { RoundedAbove, RoundedBelow,
  56.          TriangularAbove, TriangularBelow };
  57.  
  58.     Shape shape() const;
  59.     void setShape( Shape );
  60.  
  61.     void show();
  62.  
  63.     virtual int addTab( QTab * );
  64.  
  65.     void setTabEnabled( int, bool );
  66.     bool isTabEnabled( int ) const;
  67.  
  68.     QSize sizeHint() const;
  69.  
  70.     int currentTab() const;
  71.     int keyboardFocusTab() const;
  72.  
  73.     QTab * tab( int );
  74.  
  75. public slots:
  76.     void setCurrentTab( int );
  77.     void setCurrentTab( QTab * );
  78.  
  79. signals:
  80.     void  selected( int );
  81.  
  82. protected:
  83.     virtual void paint( QPainter *, QTab *, bool ) const;
  84.     virtual QTab * selectTab( const QPoint & p ) const;
  85.  
  86.     void paintEvent( QPaintEvent * );
  87.     void mousePressEvent ( QMouseEvent * );
  88.     void mouseReleaseEvent ( QMouseEvent * );
  89.     void keyPressEvent( QKeyEvent * );
  90.  
  91.     QListT<QTab> * tabList();
  92.  
  93. private:
  94.     QListT<QTab> * l;
  95.     QTabPrivate * d;
  96.  
  97.     void paintLabel( QPainter*, const QRect&, QTab*, bool ) const;
  98. };
  99.  
  100.  
  101. #endif // QTABBAR_H
  102.